//
//  UIImageLayer.h
//  Dolphin
//
//  Created by Handymood on 11-5-22.
//  Copyright 2011 __Hanydmood__. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "UIComponentBase.h"
#import "LayerInfo.h"

@class UIComponentBase;
@class LayerInfo;

@interface UIImageLayer : UIComponentBase
{
    UIImageView *imgView;
    UIImageView *hitOnView;
    UIScrollView *scrollView;
    UIActivityIndicatorView *activityIndicator;
    
    NSTimer *loaderTimer;
    NSString *curImgPath;
    
    NSURLConnection *imgLoadConnect;
    NSMutableData     *imgDataBuffer;
    
    int             button_id;//use as single button
    int             ratioMode;
    int             layoutMode;//0:original,1:keep ratio,2:clip rect
    BOOL       useOriginalRect;
    
    BOOL       loadedOver;
    
    CGRect    originalRect;
    
    UIGestureRecognizer *singleTapRecognizer;
    NSString *curTapMsg;
    BOOL       useHitMsg;
    
    BOOL       sendWebMsg;
    
    NSString *target_album_xml;
    NSString *value;
}

@property(nonatomic,copy) NSString *target_album_xml;
@property(nonatomic,copy) NSString *value;

-(void) initImage:(NSString *) imgPath
  useOriginalSize:(BOOL) inUseOriginalSize
        ratioMode:(int) inRatioMode
        layerInfo:(LayerInfo *) singleLayerInfo;

-(void) initWithAnimation:(LayerInfo *) singleLayerInfo;

-(void) initHitMsg:(NSString *) inMsg;

-(void) imgInitTransform:(UIImage *) imageNormal;
-(void) singleTapGestureCaptured:(UITapGestureRecognizer *)touch;

-(void) cacheImage:(NSString *) imageURLString 
         imageName:(NSString*)imageName
          webImage:(UIImage *)inImage;

-(UIImage *) getCurrentUIImage;
-(UIImage *) getCachedImage:(NSString *) imageName;
-(NSString *) getImageType:(NSString *) inImageFileName;

-(CGRect ) getInnerImageFrame;

-(void) layoutAdjustWithOrientation:(UIInterfaceOrientation)interfaceOrientation;
-(void) adjustSizeWithRect:(CGRect ) inRect;
-(void) reset;

@property int button_id;
@property BOOL sendWebMsg;
@end
